home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
By Popular Request 2.0
/
By Popular Request 2.0 (Arsenal Computer).ISO
/
amiga_6
/
vrctr116.lha
/
RexxProg.rexx
< prev
next >
Wrap
OS/2 REXX Batch file
|
1995-08-05
|
4KB
|
103 lines
/*\
*
* $VER:
*
\*/
VersMsg =
Author = "Dave Freeman"
Contact = "dfreeman@icecave.apana.org.au"
OPTIONS RESULTS
SIGNAL ON ERROR
SIGNAL ON BREAK_C
SIGNAL ON SYNTAX
LibList = 'rexxsupport.library rexxdossupport.library'
DO Count = 1 TO WORDS(LibList)
IF ~SHOW('l',WORD(LibList,Count)) THEN DO
IF ~ADDLIB(WORD(LibList,Count),0,-30) THEN DO
CALL GSay("Error: "WORD(LibList,Count)"not available","Damn!")
EXIT 5
END
END
END
/* ----------------------------------------------------------------------------------------------- */
/* Handle Args for the Program */
/* ----------------------------------------------------------------------------------------------- */
PARSE ARG ArgString
Template = "SomeText/F"
IF ~ReadArgs(ArgString,Template) THEN DO
ErrorMsg = "Error: Incorrect/Incomplete Call to Script*NTemplate: "Template
CALL GSay(ErrorMsg,"OK")
END
/* ----------------------------------------------------------------------------------------------- */
/* Change Variables in this section only */
/* ----------------------------------------------------------------------------------------------- */
Work_Dir = 'RT:'
Temp_Dir = 'T:'
/* ----------------------------------------------------------------------------------------------- */
/* Don't Change Variables in this section */
/* ----------------------------------------------------------------------------------------------- */
CSI = '9b'x
ClearLine = CSI || F || CSI || M
/* ----------------------------------------------------------------------------------------------- */
StoreDir = PRAGMA('D') /* Remember Current Dir and go back there at the end */
CALL PRAGMA('D',Work_Dir)
/* ----------------------------------------------------------------------------------------------- */
/* ----------------------------------------------------------------------------------------------- */
CALL PRAGMA('D',StoreDir) /* Return Current Dir to Original Dir */
/* ----------------------------------------------------------------------------------------------- */
EXIT(0)
/* ----------------------------------------------------------------------------------------------- */
/* CALL Routines start here */
/* ----------------------------------------------------------------------------------------------- */
GSay: PROCEDURE EXPOSE VersMsg /* GSay("Message Text","Option1","Option2","OptionN") */
GChoice. = 0 ; GChoiceStr = ' "'
ArgCount = ARG()
GTitle = VersMsg
GMessage = ARG(1)
DO Count = 2 TO ArgCount
GChoiceStr = GChoiceStr||ARG(Count)'" "'
END
GChoiceStr = DELSTR(GChoiceStr,LENGTH(GChoiceStr) - 1)
ADDRESS COMMAND 'RequestChoice "'GTitle'" "'GMessage'"'||GChoiceStr' >T:ChoiceRet'
CALL OPEN(ChoiceIn,'T:ChoiceRet',READ)
ChoiceRet = READLN(ChoiceIn)
IF ChoiceRet = 0 THEN ChoiceRet = ArgCount - 1
CALL CLOSE(ChoiceIn)
CALL DELETE('T:ChoiceRet')
RETURN(ChoiceRet)
/* ----------------------------------------------------------------------------------------------- */
/* Error Handling Routines start here */
/* ----------------------------------------------------------------------------------------------- */
BREAK_C:
SAY 'Break-C Signal Detected'
SAY 'Execution Ceased at line - 'SIGL
SAY 'Source Line: 'SourceLine(SIGL)
EXIT 10
RETURN
ERROR:
SYNTAX:
SAY 'Trapped Error: 'ErrorText(rc)
SAY 'Line 'SIGL' "'SourceLine(SIGL)'"'
EXIT 20
RETURN